package view;

import java.awt.Color;
import java.awt.Rectangle;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.TitledBorder;

/**
 * The Class ViewYearlyGUI that extends AbstractGUI.
 * @author yudku
 */
public class ViewYearlyGUI extends AbstractGUI
{
	
	/** The content pane. */
	private JPanel contentPane=null;
	
	/** The wrn message. */
	private JLabel wrnMessage=null;
	
	/** The label1_2. */
	private JLabel label1_2=null;
	
	/** The label2_2. */
	private JLabel label2_2=null;
	
	/** The label3_2. */
	private JButton label3_2=null;
	
	/** The label4_2. */
	private JLabel label4_2=null;
	
	/** The label5_2. */
	private JLabel label5_2=null;
	
	/** The label6_2. */
	private JButton label6_2=null;
	
	/** The label7_2. */
	private JLabel label7_2=null;
	
	/** The label8_2. */
	private JLabel label8_2=null;
	
	/** The label9_2. */
	private JButton label9_2=null;
	
	/** The date label. */
	private JLabel dateLabel = null;
	//private ChartFrame frame = null;
	
	/**
	 * Instantiates a new view yearly gui.
	 */
	public ViewYearlyGUI()
	{
		super();
		contentPane=new JPanel();
	    contentPane.setBorder(new TitledBorder(null, "Yearly Report", TitledBorder.LEADING, TitledBorder.TOP, null, null));	    
	    contentPane.setLayout(null);
	    contentPane.setOpaque(true);
	    contentPane.add(getBackButton());	
		contentPane.add(getWrnMessage());
		  //Frame
	        this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
	        this.setTitle("Yearly Report");
	        this.setContentPane(contentPane);  
	        
	        JLabel regLabel = new JLabel("Regestrated Report:");
	        regLabel.setBounds(42, 20, 190, 25);
	        contentPane.add(regLabel);
	        
	        JLabel subLabel = new JLabel("Subscribed Report:");
	        subLabel.setBounds(350, 20, 190, 25);
	        contentPane.add(subLabel);
	        
	        JLabel usageLabel = new JLabel("Subscribtion Usage Report:");
	        usageLabel.setBounds(590, 20, 190, 25);
	        contentPane.add(usageLabel);
	        
	        JLabel label1_1 = new JLabel("Median:");
	        label1_1.setBounds(42, 45, 190, 25);
	        contentPane.add(label1_1);
	        
	        JLabel label2_1 = new JLabel("Standard deviation:");
	        label2_1.setBounds(42, 84, 190, 25);
	        contentPane.add(label2_1);
	        
	        JLabel label4_1 = new JLabel("Median:");
	        label4_1.setBounds(350, 45, 190, 25);
	        contentPane.add(label4_1);
	        
	        JLabel label5_1 = new JLabel("Standard deviation:");
	        label5_1.setBounds(350, 84, 190, 25);
	        contentPane.add(label5_1);
	        	        
	        JLabel label7_1 = new JLabel("Median:");
	        label7_1.setBounds(590, 45, 190, 25);
	        contentPane.add(label7_1);
	        
	        JLabel label8_1 = new JLabel("Standard deviation:");
	        label8_1.setBounds(590, 84, 190, 25);
	        contentPane.add(label8_1);
	        
	        
	        label1_2 = new JLabel(" --- ");
	        label1_2.setBounds(240, 45, 75, 25);
	        contentPane.add(label1_2);
	        
	        label2_2 = new JLabel(" --- ");
	        label2_2.setBounds(240, 84, 75, 25);
	        contentPane.add(label2_2);
	        	        
	        label3_2 = new JButton(" Frequency distribution:");
	        label3_2.setBounds(60, 120, 175, 25);
	        contentPane.add(label3_2);
	        
	        label4_2 = new JLabel(" --- ");
	        label4_2.setBounds(500, 45, 75, 25);
	        contentPane.add(label4_2);
	        
	        label5_2 = new JLabel(" --- ");
	        label5_2.setBounds(500, 84, 75, 25);
	        contentPane.add(label5_2);
	        	        
	        label6_2 = new JButton(" -Frequency distribution:- ");
	        label6_2.setBounds(305, 120, 175, 25);
	        contentPane.add(label6_2);
	        
	        label7_2 = new JLabel(" --- ");
	        label7_2.setBounds(770, 45, 75, 25);
	        contentPane.add(label7_2);
	        
	        label8_2 = new JLabel(" --- ");
	        label8_2.setBounds(770, 84, 75, 25);
	        contentPane.add(label8_2);
	        	        
	        label9_2 = new JButton(" Frequency distribution:");
	        label9_2.setBounds(590, 120, 175, 25);
	        contentPane.add(label9_2);
	        
	        dateLabel = new JLabel(" --- ");
	        dateLabel.setBounds(770, 10, 150, 25);
	        contentPane.add(dateLabel);
	        
		    this.setLocationRelativeTo(null); //This will center the JFrame in the middle of the screen
	        this.setLocationByPlatform(true);
	        this.setSize(900, 265);
	        this.setVisible( true ); // display frame
	        this.setContentPane(contentPane);
	
	}
	
	/**
	 * This method initializes Back Button.
	 * @return the back button
	 */
	private JButton getBackButton() {
		if (backButton == null) {
			backButton = new JButton();
			backButton.setBounds(new Rectangle(339, 174, 121, 23));
			backButton.setText("Back");
			
		}
		return backButton;
	}
	
	 
	/**
	 * Sets the gen label.
	 */
	public void SetGenLabel(String text,JLabel label) {
		if (label != null) {

			label.setText(text);
		}
	}
	
	/**

	 * @return the label1_2
	 */
	public JLabel getlabel1_2() {
		
		return label1_2;
	}
	
	/**
	 * @return the label2_2
	 */
	public JLabel getlabel2_2() {
	
		return label2_2;
	}
	
	/**
	 * @return the label3_2
	 */
	public JButton getlabel3_2() {
		
		return label3_2;
	}
	
	/**
	 * Gets the label4_2.
	 *
	 * @return the label4_2
	 */
	public JLabel getlabel4_2() {
		
		return label4_2;
	}
	
	/**
	 * Gets the label5_2.
	 *
	 * @return the label5_2
	 */
	public JLabel getlabel5_2() {
	
		return label5_2;
	}
	
	/**
	 * Gets the label6_2.
	 *
	 * @return the label6_2
	 */
	public JButton getlabel6_2() {
		
		return label6_2;
	}
	
	/**
	 * Gets the label7_2.
	 *
	 * @return the label7_2
	 */
	public JLabel getlabel7_2() {
		
		return label7_2;
	}
	
	/**
	 * Gets the label8_2.
	 *
	 * @return the label8_2
	 */
	public JLabel getlabel8_2() {
	
		return label8_2;
	}
	
	/**
	 * Gets the label9_2.
	 *
	 * @return the label9_2
	 */
	public JButton getlabel9_2() {
		
		return label9_2;
	}
	
	
	/**
	 * Date_ label.
	 *
	 * @return the j label
	 */
	public JLabel date_Label() {
		
		return dateLabel;
	}

	/**
	 * Display wrn message.
	 *
	 * @param msg the msg
	 */
	public void displayWrnMessage(String msg){
		wrnMessage.setText(msg);
		wrnMessage.setVisible(true);
	}
	
	/**
	 * Gets the wrn message.
	 *
	 * @return the wrn message
	 */
	private JLabel getWrnMessage() {
		if (wrnMessage == null) {
			wrnMessage = new JLabel();
			wrnMessage.setForeground(Color.RED);
			wrnMessage.setBounds(70, 16, 320, 23);
			wrnMessage.setVisible(false);
		}
		return wrnMessage;
	}
	
	public void addButtonListener1(ActionListener listener)
	{
		label3_2.addActionListener(listener);
	}

	public void addButtonListener2(ActionListener listener)
	{
		label6_2.addActionListener(listener);
	}
	public void addButtonListener3(ActionListener listener)
	{
		label9_2.addActionListener(listener);
	}

	
	/**
	 * Click back button.
	 */
	public void clickBackButton()
	{
		this.getBackButton().doClick();
	}	
}
